import time

from selenium import webdriver
from selenium.webdriver.common.by import By

#创建浏览器驱动对象
driver=webdriver.Edge()
driver.maximize_window()
#你要测试的网址
driver.get("http://127.0.0.1:8848/pagetest/regshili.html")

driver.find_element(By.CSS_SELECTOR,"#userA").send_keys("1234456")
driver.switch_to.frame("idframe1")  #进入到frame里面 可以通过id,name或者是元素定位
driver.find_element(By.CSS_SELECTOR,"#AuserA").send_keys("1234456")
driver.switch_to.default_content() #退出到主页面
driver.find_element(By.CSS_SELECTOR,"#xja").click()
time.sleep(4)
driver.switch_to.frame("idframe2")
driver.switch_to.parent_frame()#返回上一级
driver.find_element(By.CSS_SELECTOR,"#BuserA").send_keys("1234456")

#让我们的程序休眠
time.sleep(10)
#浏览器驱动对象进行关闭
driver.close()
driver.quit()


